<?php
/**
 *
 *
 * @category     Shuxun Cms
 * @date         2015年10月18日
 * @author       Shuxun Team <kaiping.jiang@scshux.com>
 * @file         ControllerBase.php
 */
namespace Scshux\Backend\Controllers;
use Phalcon\Di;
use Phalcon\Di\FactoryDefault;
class  ControllerBase extends \Scshux\Mvc\ControllerBase
{


	/**
	 * 初始化
	 */
	public function initialize()
	{
		$this->view->setVar('__siteID', $this->getCore()->getSiteID());
		$this->view->setVar('currentUser', $this->getCore()->auth->getUser());
	}

	/**
	 *
	 * @param  $status
	 * @param string $msg
	 * @param string $data
	 */
	protected  function  sendResult($status,$msg=null,$data=null)
	{
		$result = array(
				'status' => 'n',
				'msg'    => $msg
		);
		if($status){
			$result['status'] = 'y';
		}
		if($data){
			$result['data'] = $data;
		}
		$this->sendJson($result);
	}


	/**
	 * 获取内核驱动
	 * @return \Scshux\Plugin\Core
	 */
	protected  function  getCore()
	{
		return $this->getDI()->get('core');
	}

}